package com.come4loves.game.module.skill.skillactorimpl;

import org.springframework.stereotype.Component;

import com.come4loves.game.module.fight.action.MagicChangeAction;
import com.come4loves.game.module.fight.model.FightContext;
import com.come4loves.game.module.skill.AbstractSkillActorParser;
import com.come4loves.game.module.skill.model.SkillModel;
@Component
public class CurrentMagicChangeSkill extends AbstractSkillActorParser {

	@Override
	public String skillId() {
		return "mana";
	}

	@Override
	public void handerSkill(SkillModel skillModel, FightContext fightContext) {
		int mana = Integer.valueOf(skillModel.getEffect().get("mana"));
		if (mana <= 0){
			return;
		}
		fightContext.beActorBattle.increaseCurrentMagic(mana);
		MagicChangeAction magicChangeAction = new MagicChangeAction(fightContext.beActorBattle.getActorId(), fightContext.beActorBattle.getCurrentMagic(), fightContext.beActorBattle.getMaxMagic());
		fightContext.actionRecorder.addAction(magicChangeAction);
	}

}
